/*csd*/define(function(require,exports,module){"use strict";var b=require("./console");var f=require("./utils");var e=exports;var d=[];var c=new RegExp("{.+?}","gim");e.getRoute=function(k){for(var g=0;g<d.length;g++){var l=d[g];l.matchExp.lastIndex=0;if(l.matchExp.test(k)){l.routeData={};l.matchExp.lastIndex=0;var n=k.match(l.matchExp);for(var h=0;h<l.routeKeys.length;h++){var m=RegExp["$"+(h+1)];if(m){l.routeData[l.routeKeys[h]]=m;}}return f.clone(l);}}};var a=function(j){if(j&&j.pattern&&j.target){c.lastIndex=0;var h="^"+j.pattern.replace(c,"([^\\/]+)")+"$";j.matchExp=new RegExp(h,"gim");j.routeKeys=j.pattern.match(c)||[];for(var g=0;g<j.routeKeys.length;g++){j.routeKeys[g]=j.routeKeys[g].replace("{","").replace("}","");}d.push(j);}};e.addRoute=function(g,h){if(!f.isArray(g)){g=[g];}f.each(g,function(j){this.target=(h&&h.resovleUri)?h.resovleUri(this.target):this.target;a(this);});};});